package com.cxy.datawarehouse.controller;


import com.cxy.datawarehouse.biz.StandardCodeDetailBiz;
import com.cxy.datawarehouse.entity.StandardCode;
import com.cxy.datawarehouse.entity.StandardCodeDetail;
import com.cxy.datawarehouse.response.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.Value;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@Api(tags="标准代码详情")
@RestController
@Validated
@Slf4j
@RequestMapping("/standardCodeDetail")
public class StandardCodeDetailController {
    @Resource
    StandardCodeDetailBiz standardCodeDetailBiz;

    @GetMapping(value = "/getById/{id}")
    @ApiOperation("标准代码详情列表")
    public Result<List<StandardCodeDetail>> getById(@PathVariable Long id){
        List<StandardCodeDetail> list = standardCodeDetailBiz.getById(id);
        return Result.ok(list);
    }

    @PostMapping(value = "/update")
    @ApiOperation("更新标准代码详情")
    public Result<Long> update(@RequestBody StandardCodeDetail standardCodeDetail){
        standardCodeDetailBiz.update(standardCodeDetail);
        return Result.ok();
    }

    @PostMapping(value = "/create")
    @ApiOperation("创建标准代码详情")
    public Result<Long> create(@RequestBody StandardCodeDetail standardCodeDetail){
        standardCodeDetailBiz.create(standardCodeDetail);
        return Result.ok();
    }

    @PostMapping(value = "/delete/{id}")
    @ApiOperation("通过Id删除标准代码详情")
    public Result<Long> deleteById(@PathVariable Long id){
        standardCodeDetailBiz.deleteById(id);
        return Result.ok();
    }
}
